import re

text = ""
with open("./poetry.txt",mode="r",encoding="utf-8") as f:
    text = "".join(f.readlines())

# 使用正则表达式删除每行中冒号前的内容
cleaned_text = re.sub(r'^[^:]+:', '', text, flags=re.MULTILINE)

print(cleaned_text.replace("\n", "").replace("，","").replace("。",""))


with open("./poetry1.txt",mode="w",encoding="utf-8") as f:
    f.write(cleaned_text.replace("\n", "").replace("，","").replace("。",""))